<?php
namespace JsonRpc\Services\System;
use JsonRpc\Models\SysUser;
use JsonRpc\Services\CommonService;
use JsonRpc\Utils\Utils;
use JsonRpc\Models\SysButton;

/**
 *  用户
 * @author walkor <worker-man@qq.com>
 */
class ButtonService
{
    use CommonService;

    private static function getBaseModel(){
        return "JsonRpc\\Models\\SysButton";
    }

    public static function ping(){
        return 'OK';
    }

   static function saveData($params){
        if(isset($params['id']) && $params['id']){
            //更新
            $model = SysButton::find($params['id']);

        }else{
            //新增
            unset($params['id']);
            $model = new SysButton();
            $model->client_id = 1;
            $model->org_id = 1;
        }

       $model->name = $params['name'];
       $model->code = $params['code'];
       $model->icon_style = $params['icon_style'];
       $model->func = $params['func'];
       $model->is_active = $params['is_active'];
        return $model->save();
    }
}
